#ifndef INCLUDE_AECS_ERROR_H_
#define INCLUDE_AECS_ERROR_H_

// clang-format off

#define AECS_ERROR(x)                            (0xFFFF0000&((x) << 16))
#define AECS_ERROR_CODE(rc)                      (rc)

#define AECS_ERROR_GENERIC                                  AECS_ERROR(0xA000)
#define AECS_ERROR_SERVER_REMOTE_ENDPOINT                   AECS_ERROR(0xA001)
#define AECS_ERROR_SERVER_NOT_WORKING_FOR_SYNC              AECS_ERROR(0xA002)
#define AECS_ERROR_CONF_SSL_REQUIRED                        AECS_ERROR(0xA003)
#define AECS_ERROR_CONF_RPC_REQUIRED                        AECS_ERROR(0xA004)
#define AECS_ERROR_SERVER_NOT_WORKING_STATUS                AECS_ERROR(0xA005)

#define AECS_ERROR_PARAMETER                                AECS_ERROR(0xA101)
#define AECS_ERROR_PARAMETER_NAME_EMPTY                     AECS_ERROR(0xA101)
#define AECS_ERROR_PARAMETER_NAME_TOO_LONG                  AECS_ERROR(0xA102)
#define AECS_ERROR_PARAMETER_NAME_INVALID_CHAR              AECS_ERROR(0xA104)
#define AECS_ERROR_PARAMETER_FLAGS_EMPTT                    AECS_ERROR(0xA105)
#define AECS_ERROR_PARAMETER_INVALID_ACTION                 AECS_ERROR(0xA106)
#define AECS_ERROR_PARAMETER_POLICY_PARSE                   AECS_ERROR(0xA107)
#define AECS_ERROR_PARAMETER_KUBECONFIG_PARSE               AECS_ERROR(0xA108)

#define AECS_ERROR_ADMIN_AUTH_INVALID_PASSWORD              AECS_ERROR(0xA201)
#define AECS_ERROR_ADMIN_AUTH_EMPTY_PUBLIC_KEY              AECS_ERROR(0xA202)
#define AECS_ERROR_ADMIN_FUNCTION_NAME                      AECS_ERROR(0xA204)
#define AECS_ERROR_ADMIN_INIT_EXISTED_PUBLIC_KEY            AECS_ERROR(0xA205)
#define AECS_ERROR_ADMIN_INVALID_BASE64_PUBLIC_KEY          AECS_ERROR(0xA206)
#define AECS_ERROR_ADMIN_EMPTYY_SERVICE_NAME                AECS_ERROR(0xA207)
#define AECS_ERROR_ADMIN_EMPTYY_HOST_NAME                   AECS_ERROR(0xA208)
#define AECS_ERROR_ADMIN_NOT_EXISTED_BACKUP                 AECS_ERROR(0xA209)

#define AECS_ERROR_SERVICE_MAX_REGISTERED                   AECS_ERROR(0xA301)
#define AECS_ERROR_SERVICE_FUNCTION_NAME                    AECS_ERROR(0xA302)

#define AECS_ERROR_SECRET_CREATE_ACHIEVE_MAX                AECS_ERROR(0xA411)
#define AECS_ERROR_SECRET_CREATE_EMPTY_SERVICE_NAME         AECS_ERROR(0xA412)
// The service name in request is not the same as what in spec
#define AECS_ERROR_SECRET_CREATE_MISMATCH_SERVICE_NAME      AECS_ERROR(0xA413)
#define AECS_ERROR_SECRET_CREATE_NO_SECRET_TYPE             AECS_ERROR(0xA414)
#define AECS_ERROR_SECRET_CREATE_EMPTY_DATE                 AECS_ERROR(0xA415)
#define AECS_ERROR_SECRET_CREATE_DATA_TOO_LONG              AECS_ERROR(0xA416)
#define AECS_ERROR_SECRET_CREATE_UNSUPPORTED_TYPE           AECS_ERROR(0xA417)
#define AECS_ERROR_SECRET_CREATE_INITIALIZED_DATA           AECS_ERROR(0xA418)
#define AECS_ERROR_SECRET_UPDATE_MISMATCH_SERVICE_NAME      AECS_ERROR(0xA421)
#define AECS_ERROR_SECRET_UPDATE_MISMATCH_SECRET_NAME       AECS_ERROR(0xA422)
#define AECS_ERROR_SECRET_UPDATE_NO_SECRET_TYPE             AECS_ERROR(0xA423)
#define AECS_ERROR_SECRET_UPDATE_READONLY_SECRET            AECS_ERROR(0xA424)
#define AECS_ERROR_SECRET_DESTROY_EMPTY_NAME                AECS_ERROR(0xA431)
#define AECS_ERROR_SECRET_GET_EMPTY_SERVICE_NAME            AECS_ERROR(0xA441)
#define AECS_ERROR_SECRET_GET_EMPTY_SECRET_NAME             AECS_ERROR(0xA442)
#define AECS_ERROR_SECRET_GET_MISMATCH_SERVICE_NAME         AECS_ERROR(0xA443)
#define AECS_ERROR_SECRET_GET_MISMATCH_SECRET_NAME          AECS_ERROR(0xA444)
#define AECS_ERROR_SECRET_GET_EMPTY_QUOTE                   AECS_ERROR(0xA445)
#define AECS_ERROR_SECRET_GETPUB_EMPTY_SERVICE_NAME         AECS_ERROR(0xA451)
#define AECS_ERROR_SECRET_GETPUB_EMPTY_SECRET_NAME          AECS_ERROR(0xA452)
#define AECS_ERROR_SECRET_GETPUB_MISMATCH_SERVICE_NAME      AECS_ERROR(0xA453)
#define AECS_ERROR_SECRET_GETPUB_MISMATCH_SECRET_NAME       AECS_ERROR(0xA454)
#define AECS_ERROR_SECRET_GETPUB_UNSUPPORTED_TYPE           AECS_ERROR(0xA455)
#define AECS_ERROR_SECRET_LIST_ERROR                        AECS_ERROR(0xA460)

// AECS_ERROR_STORAGE_EXISTED_AUTH: The Storage authentication information
// is existed after provision or remote sync. We allow to do provision only once.
#define AECS_ERROR_STORAGE_EXISTED_AUTH                     AECS_ERROR(0xAA01)
#define AECS_ERROR_STORAGE_AUTH_NOT_VALID                   AECS_ERROR(0xAA02)
#define AECS_ERROR_STORAGE_INVALID_LIB_OPENED               AECS_ERROR(0xAA03)
#define AECS_ERROR_STORAGE_NO_FUNCTION_CREATE               AECS_ERROR(0xAA04)
#define AECS_ERROR_STORAGE_NO_FUNCTION_DELETE               AECS_ERROR(0xAA05)
#define AECS_ERROR_STORAGE_NO_FUNCTION_LISTALL              AECS_ERROR(0xAA06)
#define AECS_ERROR_STORAGE_NO_FUNCTION_GETVALUE             AECS_ERROR(0xAA07)
#define AECS_ERROR_STORAGE_NO_FUNCTION_CHECKEXIST           AECS_ERROR(0xAA08)

#define AECS_ERROR_STORAGE_OSS_INVALID_CLIENT               AECS_ERROR(0xAA11)
#define AECS_ERROR_STORAGE_OSS_CREATE_NAME_EXISTED          AECS_ERROR(0xAA12)
#define AECS_ERROR_STORAGE_OSS_CREATE_FAILED                AECS_ERROR(0xAA13)
#define AECS_ERROR_STORAGE_OSS_DELETE_NOT_EXISTED           AECS_ERROR(0xAA15)
#define AECS_ERROR_STORAGE_OSS_DELETE_EMPTY_PREFIX          AECS_ERROR(0xAA16)
#define AECS_ERROR_STORAGE_OSS_DELETE_NONE                  AECS_ERROR(0xAA17)
#define AECS_ERROR_STORAGE_OSS_DELETE_FAILED                AECS_ERROR(0xAA18)
#define AECS_ERROR_STORAGE_OSS_DELETE_LIST_ALL              AECS_ERROR(0xAA19)
#define AECS_ERROR_STORAGE_OSS_DELETE_WRONG_PREFIX          AECS_ERROR(0xAA1A)
#define AECS_ERROR_STORAGE_OSS_GET_FAILED                   AECS_ERROR(0xAA1C)
#define AECS_ERROR_STORAGE_OSS_GET_VALUE_TOO_LARGE          AECS_ERROR(0xAA1D)
#define AECS_ERROR_STORAGE_OSS_LIST_FAILED                  AECS_ERROR(0xAA1F)

#define AECS_ERROR_STORAGE_FS_CREATE_NAME_EXISTED           AECS_ERROR(0xAA21)
#define AECS_ERROR_STORAGE_FS_MKDIR                         AECS_ERROR(0xAA22)
#define AECS_ERROR_STORAGE_FS_DELETE_FAILED                 AECS_ERROR(0xAA24)
#define AECS_ERROR_STORAGE_FS_GET_NAME_NOT_EXISTED          AECS_ERROR(0xAA28)
#define AECS_ERROR_STORAGE_FS_DELETE_EMPTY_PREFIX           AECS_ERROR(0xAA29)
#define AECS_ERROR_STORAGE_FS_LIST_OPEN_DIR_FAILED          AECS_ERROR(0xAA2C)

#define AECS_ERROR_STORAGE_MINIO_INVALID_CLIENT             AECS_ERROR(0xAA31)
#define AECS_ERROR_STORAGE_MINIO_CREATE_NAME_EXISTED        AECS_ERROR(0xAA32)
#define AECS_ERROR_STORAGE_MINIO_CREATE_FAILED              AECS_ERROR(0xAA33)
#define AECS_ERROR_STORAGE_MINIO_DELETE_NOT_EXISTED         AECS_ERROR(0xAA35)
#define AECS_ERROR_STORAGE_MINIO_DELETE_EMPTY_PREFIX        AECS_ERROR(0xAA36)
#define AECS_ERROR_STORAGE_MINIO_DELETE_NONE                AECS_ERROR(0xAA37)
#define AECS_ERROR_STORAGE_MINIO_DELETE_FAILED              AECS_ERROR(0xAA38)
#define AECS_ERROR_STORAGE_MINIO_DELETE_LIST_ALL            AECS_ERROR(0xAA39)
#define AECS_ERROR_STORAGE_MINIO_DELETE_WRONG_PREFIX        AECS_ERROR(0xAA3A)
#define AECS_ERROR_STORAGE_MINIO_GET_FAILED                 AECS_ERROR(0xAA3C)
#define AECS_ERROR_STORAGE_MINIO_GET_VALUE_TOO_LARGE        AECS_ERROR(0xAA3D)
#define AECS_ERROR_STORAGE_MINIO_LIST_FAILED                AECS_ERROR(0xAA3F)
#define AECS_ERROR_STORAGE_MINIO_AUTH_EMPTY                 AECS_ERROR(0xAA40)
#define AECS_ERROR_STORAGE_MINIO_AUTH_ILLEGAL               AECS_ERROR(0xAA41)
#define AECS_ERROR_STORAGE_MINIO_AUTH_DIFFERENT             AECS_ERROR(0xAA42)

#define AECS_ERROR_CLIENT_EMPTY_SERVER_PUBLIC_KEY           AECS_ERROR(0xAB01)
#define AECS_ERROR_CLIENT_UNSUPPORTED_AUTH_TYPE             AECS_ERROR(0xAB02)
#define AECS_ERROR_CLIENT_SECRET_NONCE_MISMATCHED           AECS_ERROR(0xAB03)

#define AECS_ERROR_ENCLAVE_NO_RA_REPORT                     AECS_ERROR(0xAE01)
#define AECS_ERROR_ENCLAVE_NO_PUBLIC_KEY                    AECS_ERROR(0xAE02)
#define AECS_ERROR_ENCLAVE_INVALID_ID                       AECS_ERROR(0xAE03)
#define AECS_ERROR_ENCLAVE_SEALED_REMOTE_IDENTITY           AECS_ERROR(0xAE04)
#define AECS_ERROR_ENCLAVE_CREATE_FAILED                    AECS_ERROR(0xAE05)

// clang-format on

#endif  // INCLUDE_AECS_ERROR_H_
